import 'package:dio/dio.dart';
import 'package:sainbainu/common/http/http.dart';

class ContentApi {
  /// 发布
  Future<Map<String, dynamic>> create(Map data) async {
    Response res = await Http.post('/api/social/note/add', data: data);
    return res.data;
  }

  /// 推荐列表
  Future<Map<String, dynamic>> recommentList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/social/note/recommend_list',
      params: params,
    );
    return res.data;
  }

  /// 关注列表
  Future<Map<String, dynamic>> followList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/social/note/follow_list',
      params: params,
    );
    return res.data;
  }

  /// 小组推荐帖子列表
  Future<Map<String, dynamic>> groupRecommentContentList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/social/note/recommend_group_list',
      params: params,
    );
    return res.data;
  }

  /// 我的小组帖子列表
  Future<Map<String, dynamic>> myGroupContentList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/social/note/my_group_list',
      params: params,
    );
    return res.data;
  }

  /// 点赞
  Future<Map<String, dynamic>> giveAdd(Map data) async {
    Response res = await Http.post('/api/customer/give/add', data: data);
    return res.data;
  }

  /// 取消点赞
  Future<Map<String, dynamic>> giveCancel(Map data) async {
    Response res = await Http.post('/api/customer/give/del', data: data);
    return res.data;
  }

  /// 点赞列表
  Future<Map<String, dynamic>> giveList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/customer/give/note_list',
      params: params,
    );
    return res.data;
  }

  /// 收藏
  Future<Map<String, dynamic>> collectionAdd(Map data) async {
    Response res = await Http.post('/api/customer/collection/add', data: data);
    return res.data;
  }

  /// 取消收藏
  Future<Map<String, dynamic>> collectionCancel(Map data) async {
    Response res = await Http.post('/api/customer/collection/del', data: data);
    return res.data;
  }

  /// 收藏列表
  Future<Map<String, dynamic>> collectionList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/customer/collection/note_list',
      params: params,
    );
    return res.data;
  }

  /// 帖子详情
  Future<Map<String, dynamic>> contentDetail(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get('/api/social/note/detail', params: params);
    return res.data;
  }

  /// 我的作品列表
  Future<Map<String, dynamic>> myList(
    Map<String, dynamic> params,
  ) async {
    Response res = await Http.get(
      '/api/social/note/my_list',
      params: params,
    );
    return res.data;
  }

  /// 删除帖子
  Future<Map<String, dynamic>> del(Map data) async {
    Response res = await Http.post('/api/social/note/del', data: data);
    return res.data;
  }

  /// 新增浏览
  Future<Map<String, dynamic>> viewAdd(Map data) async {
    Response res = await Http.post('/api/customer/visit/add', data: data);
    return res.data;
  }

  /// 新增分享
  Future<Map<String, dynamic>> shareAdd(Map data) async {
    Response res = await Http.post('/api/customer/share/add', data: data);
    return res.data;
  }
}
